package edu.jmu.action.schedule;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import edu.jmu.action.BaseAction;
import edu.jmu.bean.PageView;
import edu.jmu.bean.schedule.MyNote;
import edu.jmu.service.schedule.NoteService;
import edu.jmu.utils.WebUtil;

@Controller
@Scope(value="prototype")
public class NoteManageAction extends BaseAction<MyNote>{
	private static final long serialVersionUID = 6534535440797983653L;
	
	@Resource
	private NoteService noteService;
	
	private MyNote myNote;
	
	public String addNote(){
		myNote.setCreateUser(WebUtil.getUser());
		noteService.save(myNote);
		return SUCCESS;
	}

	public String listNote(){
		pageView = new PageView<MyNote>(maxresult,currentpage);
		pageView.setQueryResult(noteService.getScrollData(pageView.getFirstResult(),pageView.getMaxresult()));
		return SUCCESS;
	}
	
	/**	set and get */
	public MyNote getMyNote() {
		return myNote;
	}
	public void setMyNote(MyNote myNote) {
		this.myNote = myNote;
	}
	
}
